package main

import "fmt"
import "time"


func queryDb(ch chan int) {
        time.Sleep(3*time.Second)
        ch <- 100
}


func main() {
    ch := make(chan int)
    go queryDb(ch)
    t := time.NewTicker(5*time.Second)

    select {
    case v := <-ch:
        fmt.Println("result", v)
    case <-t.C:
        fmt.Println("timeout")
    }

}




